exports.deleteBottomMenu = function(req,res){

    var bodyParams = req.routeInfo.bodyParams;

    //查询该菜单是否有子菜单
    function isUsedSonMenu(cb){

        R.SEND_HTTP(
            req,
            res,
            {
                url    : CORE_APIConfig.coreAPI.cmsBottomMenuSearch.Request_Api_Url + "/cbm_fid/" + bodyParams.cbm_id + "/cbm_is_delete/0",
                method : 'POST',
                data   : {
                    fields : 'cbm_id'
                }
            },
            function (data) { 

                console.log(data);
            
                if(data.result.data.length > 0){
                    return RES.errorResponse(res,'抱歉，该菜单中包含子菜单，请先删除子菜单');
                }

                cb();
                
            }
        );

    }
    

    //删除菜单
    function deleteBottomMenu(cb){

        R.SEND_HTTP(
            req,
            res,
            {
                url    : CORE_APIConfig.coreAPI.cmsBottomMenuDelete.Request_Api_Url,
                method : 'POST',
                data   : {
                    delete_where  : 'cbm_id',
                    cbm_id        : bodyParams.cbm_id,
                    cbm_is_delete : 1
                }
            },
            function (data) { 

                cb();
                
            }
        );

    }
    

    F.Serial([
        isUsedSonMenu,
        deleteBottomMenu
    ],() => {
        RES.successResponse(res);
    })

}